<!DOCTYPE html>
<html lang="en">

<head>
    <meta charset="UTF-8">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title>Document</title>
    <style>
        .arrow {
            padding: 10px;
            width: 15px;
            height: 15px;
            border: 1px solid #ddd;
            margin: 20px;
        }

        /* 箭头样式 */
        .arrow::after {
            content: "";
            display: block;
            height: inherit;
            box-sizing: border-box;
            border-left: 1px solid #ddd;
            border-top: 1px solid #ddd;
            /* 过渡动画 */
            transition: transform 1s;
        }

        /* 位移+旋转，实现向上箭头 */
        .arrow-up::after {
            transform: translateY(25%) rotate(45deg);
        }

        /* 位移+旋转，实现向下箭头 */
        .arrow-down::after {
            transform: translateY(-25%) rotate(-135deg);
        }

        /* 鼠标移入，向上箭头变向下箭头 */
        .arrow-up:hover::after {
            transform: translateY(-25%) rotate(-135deg);
        }

        /* 鼠标移入，向下箭头变向上箭头 */
        .arrow-down:hover::after {
            transform: translateY(25%) rotate(45deg);
        }
    </style>
</head>

<body>
    <div class="arrow arrow-up"></div>
    <div class="arrow arrow-down"></div>
</body>

</html>
